package com.cqc.lite.service.impl;


import com.cqc.lite.dao.PermissionDao;
import com.cqc.lite.domain.Permission;
import com.cqc.lite.service.PermissionService;
import com.cqc.lite.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

@Service
@Transactional
public class PermissionServiceImpl implements PermissionService {

    private final PermissionDao permissionDao;
    @Autowired
    public PermissionServiceImpl(PermissionDao permissionDao){
        this.permissionDao=permissionDao;
    }


    @Override
    public List<Permission> findAll() {
        return permissionDao.findAll();
    }

    @Override
    public int save(Permission permission) {
        permission.setId(UUIDUtils.getId());
        return permissionDao.save(permission);
    }
}
